/*  This file is part of the comicconquer project
    Copyright (C) 2010 Reach <reach334@gmail.com>

    ComicConquer is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    This software is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
    Lesser General Public License for more details.

    You should have received a copy of the GNU Lesser General Public 
    License along with this software.  If not, see <http://www.gnu.org/licenses/>.

*/

#ifndef FILEBROWSER_H
#define FILEBROWSER_H

#include "mist.h"
#include "onyx/ui/tree_view_dialog.h"
#include "onyx/ui/buttons.h"
#include "onyx/ui/onyx_dialog.h"
/**
 * Browser for open comic.
 * 
 * @author reach (5/26/2010)
 */
class FileBrowser : public ui::OnyxDialog
{
    Q_OBJECT

    //-- constructor
public:
    FileBrowser(QString defDir, QWidget* parent = 0);

    //-- public methods
public:
    void refreshScreen(ScreenProxy::Waveform w = ScreenProxy::GU, bool whole = false);
    static QString fileBrowse(QString defDir = QString("/"), QWidget* parent = 0);

    //-- private slots
private slots:
    bool event(QEvent* e);
    void selectedItem(const QModelIndex& index);

    //-- private members
private:
    QStandardItemModel* m_model;
    QDir m_dir;
    QString m_fileName;
    bool m_start;

    // UI
    QVBoxLayout* m_vlayout;
    ui::OnyxTreeView* m_treeView;

    QTimer m_timer;

private:
    void entryDir(const QString strDir);

};

#endif  // FILEBROWSER_H
